package gray.boolber.vk;

import gray.boolber.vk.web.api.callbacks.VKActionListener;
import gray.boolber.vk.web.api.manager.VKManager;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;

public class VKStartActivity extends Activity {
    private VKManager vkManager;

	/** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        vkManager = VKManager.INSTANCE;
       
        vkManager.init(this);
//        vkManager.postToWall("Hello Boolber!", new VKActionListener(){
//			@Override
//			public void onSuccess(boolean isSuccessful) {
//				int y=0;
//				y++;
//				
//			}
//        });
        if(!vkManager.isAccessTokenValid()){//!RuntimePreferences.from(this).isAccessTokenValid()){
        	vkManager.showLoginDialog();
        }
    	vkManager.getNewsFeed("", new VKActionListener() {
			
			@Override
			public void onSuccess(boolean isSuccessful) {
				startActivity(new Intent(VKStartActivity.this,NewsFeedActivity.class));
				finish();
				
			}
		});
       
    }
}